<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>表格动态列</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
			<link rel="stylesheet" type="text/css" href="styles.css">
		-->
		<jsp:include page="../basic/easyui_loder.jsp" flush="true"/>

		<script type="text/javascript">
			$(document).ready(function(){
				
				/*
				$.ajax({
					type : "POST",
					dataType : "json",
					url : "luceneAction_findAllDocuments",
					success : function(data) {
						$("#detail").datagrid( {
							columns : data.columns,
							title : '动态列测试'
						}).datagrid("loadData", data);
					},
					error : function(XMLHttpRequest, textStatus,
							errorThrown) {
						alert("error" + textStatus);
					}
				});
				*/
				
				/**
				 * 此方法在第一次查询时查两次
				 * 可能需要改进
				 * @param {Object} back
				 */
				$.ajax({
					type : "POST",
					dataType : "json",
					url : "luceneAction_findAllDocuments",
					async : true,
					success : function(back) {
						$("#detail").datagrid({
							title:'表格动态列',
							width: 1000,
							height: 'auto',
							striped: true,	//斑马线
							pageSize : 50,
							rownumbers: true,
							singleSelect: false,	//是否单选
							url: 'testAction_getItems',
							pagination: true,	//分页
							frozenColumns : [[	//冻结列
								{field : 'ck',checkbox : true}
							]],
							columns : back.columns,
							url: "luceneAction_findAllDocuments"
						}).datagrid("load", back);
					}
				});
			});
		</script>

	</head>

	<body>
		<hr />
		<h2>
			表格动态列
		</h2>

		<div id="detail" align="center"></div>

		<br />
		<br />

	</body>
</html>
